package No101_200.No161_170.CompareVersionNumbers_165;

public class Solution {
    public static int compareVersion(String version1, String version2) {
    	String[] v1 = version1.split("\\.");
    	String[] v2 = version2.split("\\.");    	
    	int length = (v1.length > v2.length) ? v1.length : v2.length;
    	for (int i = 0; i < length; i++) {
			int a = (i < v1.length) ? Integer.parseInt(v1[i]) : 0;
			int b = (i < v2.length) ? Integer.parseInt(v2[i]) : 0;
			if (a>b) {
				return 1;
			}else if(a<b){
				return -1;
			}else{
				continue;
			}
		}
    	return 0;
    }
    
    public static void main(String[] args) {
		System.out.println(compareVersion("1.1", "0.3"));
	}
}
